package cn.bs.seckill.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {

    private long code;
    private String message;
    private Object obj;

    //登录成功返回的消息
    public static RespBean success(){
        return new RespBean(RespBeanEnum.SUCCESS.getCODE(),
                RespBeanEnum.SUCCESS.getMESSAGE(),null);
    }

    public static RespBean success(Object obj){
        return new RespBean(RespBeanEnum.SUCCESS.getCODE(),
                RespBeanEnum.LOGIN_FAILEDP.getMESSAGE(), obj);
    }

    //登录失败返回的消息
    public static RespBean error(RespBeanEnum pe){
        return new RespBean(pe.getCODE(),pe.getMESSAGE(),null);
    }

    public static RespBean error(RespBeanEnum pe,Object obj){
        return new RespBean(pe.getCODE(),pe.getMESSAGE(),obj);
    }
}
